#正三角

for i in range(1,10,1):
    j = 1
    while j<=i:
        if j >= 3 and i <= 4:
            print(" {} x {} = {}".format(j, i, j * i), end="")
        else:
            print("{} x {} = {} ".format(j, i, j * i), end="")
        j += 1
    print()
print("+" * 30)
#倒三角
for i in range(1,10,1):
    for j in range(i,10,1):
        if i <= 3 and j == i+1:
            print(" ",end="")
        elif i <= 2 and j == i+2:
            print(" ",end="")
        elif i == 2 and j == i+3:
            print(" ",end="")
        elif i == 1 and j ==i +3:
            print(" ",end="")
        elif i == 1 and j == i + 4:
            print(" ", end="")
        elif i == 1 and j == i + 5:
            print(" ", end="")
        elif i == 1 and j == i + 6:
            print(" ", end="")
        elif i == 1 and j == i + 7:
            print(" ", end="")
        elif i == 1 and j == i + 8:
            print(" ", end="")
        print("{} x {} = {} ".format(i, j, j * i), end="")
    print()

#视频写法
for i in range(1,10):
    for j in range(1,i+1):
        print("{} * {} = {:<{}}".format(j,i,j*i,2 if j == 1 else 3),
              end='\n' if i == j else '')